using System.Collections.Generic;
using Abs.Core.Models;
using Abs.Core.Util;
using Abs.Core.DAL.EntityFramework;
using Abs.Core.Models.User;

namespace Abs.Core.DAL.SetUpDatabase
{
    internal partial class AbsInitializer
    {
        private IList<User> InitializeUsers(IList<Role> roles, AbsContext absContext)
        {
            const int userRole = (int) RoleEnum.User;
            const int adminLevel = (int) RoleEnum.Admin;

            var users = new List<User>
                        {
                            new User
                            {
                                Name = "Felicity Huffman",
                                Email = "felicity.huffman@abs.com",
                                RoleId = userRole,
                                Password = "123456"
                            },
                            new User
                            {
                                Name = "Orson Hodge",
                                Email = "orson.hodge@abs.com",
                                RoleId = userRole,
                                Password = "123456"
                            },
                            new User
                            {
                                Name = "Marcia Cross",
                                Email = "marcia.cross@abs.com",
                                RoleId = userRole,
                                Password = "123456"
                            },
                            new User
                            {
                                Name = "Eva Longoria",
                                Email = "eva.longoria@abs.com",
                                RoleId = userRole,
                                Password = "123456"
                            },
                            new User
                            {
                                Name = "Mike Delfino",
                                Email = "mike.delfino@abs.com",
                                RoleId = userRole,
                                Password = "123456"
                            },
                            new User
                            {
                                Name = "Carlos Solis",
                                Email = "carlos.solis@abs.com",
                                RoleId = userRole,
                                Password = "123456"
                            },
                            new User
                            {
                                Name = "Porter Scavo",
                                Email = "porter.scavo@abs.com",
                                RoleId = userRole,
                                Password = "123456"
                            },
                            new User
                            {
                                Name = "Julie Mayer",
                                Email = "julie.mayer@abs.com",
                                RoleId = userRole,
                                Password = "123456"
                            },
                            new User
                            {
                                Name = "Andrew Van de Kamp",
                                Email = "andrew.van.de.kamp@abs.com",
                                RoleId = userRole,
                                Password = "123456"
                            },
                            new User
                            {
                                Name = "Sheldon Cooper",
                                Email = "sheldon.cooper@abs.com",
                                RoleId = adminLevel,
                                Password = "123456"
                            }
                        };
            users.ForEach(user => absContext.Users.Add(user));
            absContext.SaveChanges();

            return users;
        }//end of private IList<User> InitializeUsers(IList<Role> roles, AbsContext absContext)
    }
}//end of namespace ABS.DAL